<?php
namespace app1\index\model;

use think\Model;

class User extends Model
{

    public $user;

    /**
     * 登录函数
     * 
     * @param string $user_name            
     * @param string $user_password            
     * @return bool
     */
    public function login($user_name, $user_password)
    {
        $con = [
            "user_name" => $user_name,
            "user_password" => $user_password
        ];
        return $this->where($con)->find();
    }

    /**
     * 注册函数
     * 
     * @param string $user_name            
     * @param string $user_password            
     * @return number|\think\false
     */
    public function regist($user_name, $user_password)
    {
        $this->data([
            'user_name' => $user_name,
            'user_password' => $user_password
        ]);
        $res = $this->save();
        return $res;
    }
    
    public function find($user_name)
    {
        $res = $this->where('user_name',$user_name)->find();
        return $res;
    }
}